﻿using MediatR;
using TraceabilityApp_Api.Application.Command.DeepProcessing_深加工_;
using TraceabilityApp_Domain;
using TraceabilityApp_ErrorCode;
using TraceabilityApp_Infrastructure;

namespace TraceabilityApp_Api.Application.Handler.DeepProcessing_深加工_
{
    public class DelSupplierHandler : IRequestHandler<DelSupplierCommand, ApiResult<int>>
    {
        private readonly IBase<SupplierModel> supplierRepo;

        public DelSupplierHandler(IBase<SupplierModel> supplierRepo)
        {
            this.supplierRepo = supplierRepo;
        }
        public async Task<ApiResult<int>> Handle(DelSupplierCommand request, CancellationToken cancellationToken)
        {
            ApiResult<int> result =new ApiResult<int>();
            result.Code = ApiEnum.OK;
            result.Msg = "删除成功";
            var model=new SupplierModel();
            model.SupplierId = request.SupplierId;
            await supplierRepo.Del(model);
            return await Task.FromResult(result);
        }
    }
}
 